<?PHP
require_once("class.wp_environment.php");

class Sandbox extends WpEnvironemt{

private $entryPageName = null;
private $cookies = null;

public function __construct($entryPageName) {
	$this->cookies = array();
	$this->entryPageName = $entryPageName;
}

public function flickrOAUTH()
{
	$url = 'http://flickr.com';
	$response  = $this->doGet($url);
	
	echo "<PRE>".htmlentities($response)."</pre><hr/>";
}

public function postNewPost($data)
{
	$returnHeader = true;
	
	try{
		/************* collect cookies ****************/
		$url = 'http://www.somewhereinblog.net/mobile/login';
		$this->returnHeader = true;
		$cookieDirectory = $this->doCollectCookies($url);
		//echo "<PRE>".htmlentities($response)."</pre>";
		echo "<pre>Cookies: $cookieDirectory</pre><hr/>";

		/********************* login now **********************/
		$data= array();
		$data['username']='panda';
		$data['password'] = 'natasha';
		
		$url = 'http://www.somewhereinblog.net/loginmanager/login/mobile';
		$response  = $this->doPost( $url, $data, $cookieDirectory);
		echo "<PRE>".htmlentities($response)."</pre><hr/>";
		
		/**************** do write new post ******************/
		unset($data);
		$data= array();
		$data['title']='kono title nai';
		$data['content'] = 'ajaire testing';
		$data['bbafront'] = '1';
		$data['directPublish'] = '1';
		$data['post_id'] = '0';
		$data['adautodraft_post_id']= '0';
		
		$url = 'http://www.somewhereinblog.net/blog/panda/newpost';
		$response  = $this->doPost( $url, $data, $cookieDirectory);
		echo "<PRE>".htmlentities($response)."</pre>";
	// postNewPost
	// return new post url
	}
	catch(Exception $e)
	{
		$this->printException($e);
	}
}

protected function initAllVariables()
{

}

}
?>